import { instance } from "../utils/request";


export const getHeadSwiperList = async (list) => {
	const res = await instance({
		url: '/homeBanner'
	})
	list.value = res.data.data
}

export const getCenterList = async (list) => {
	const res = await instance({
		url: '/randomWall'
	})
	list.value = res.data.data
}

export const getBottomList = async (list) => {
	const res = await instance({
		url: '/classify?pageSize=9'
	})
	list.value = res.data.data
}

export const wallpaperRate = async (obj) => {
	const res = await instance({
		url: `/setupScore?classid=${obj.classid}&wallId=${obj.wallid}&userScore=${obj.userScore}`,
	})
	if(res.data.errCode === 0) {
		return true;
	}else {
		return false;
	}
}

export const downloadWallpaper = async (obj) => {
	const res = await instance({
		url:`/downloadWall?classid=${obj.classid}&wallId=${obj.wallid}`
	})
	
	return res.data
}

export const getTypeList = async (n) => {
	const res = await instance({
		url:`/classify?pageNum=${n}&pageSize=9`
	})
	return res.data
}

export const getWallpaper =async (obj) => {
	const res = await instance({
		url: `/wallList?classid=${obj.classid}&pageNum=${obj.n}`
	})

	return res.data
}

export const SearchWallpaper = async (obj) => {
	const res = await instance({
		url: `/searchWall?keyword=${obj.str}&pageNum=${obj.n}`
	})
	return res.data
}